/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejbmensajeria;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

/**
 *
 * @author usuario
 */
@MessageDriven(mappedName = "jms/Buzon", activationConfig = {
    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
})
public class ReceptorMensajes implements MessageListener {
    
    public ReceptorMensajes() {
    }
    
    @Override
    public void onMessage(Message message) {
        try {
            ObjectMessage om = (ObjectMessage) message;
            System.out.println("--->" + om.getObject());
        } catch (JMSException jMSException) {
            System.out.println("Error "+ jMSException);
        }
    }
}
